<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="app">
        <h1>{{msg}}</h1>
        <div v-if="obj.user">
            <h1>用户名：{{obj.user.username}}</h1>
            <h1>密码：{{obj.user.password}}</h1>
        </div>
    </div>
    <script src="../vue.js"></script>
    <script>
        const vm = new Vue({
            data: {
                obj: {},
                msg: "模拟ajax异步传数据"
            },
            mounted() {
                setTimeout(function() {
                    vm.obj = {
                        user: {
                            username: "不吃鱼d猫",
                            password: 110110
                        }
                    }
                }, 2000)
            }
        }).$mount(".app")
    </script>
</body>

</html>